<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;

class StoreUserPostRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            //
            'name' => 'required',
            'password' => 'required|confirmed',
            'email' => 'required|email',
            'phone' => 'required|digits:11',
        ];
     
    }


     //设置报错信息
    public function messages()
    {
        return [
        'email.required' => '邮箱必须填写',
        'name.required' => '用户名必须填写',
        'email.email' => '邮箱规则不合法',
        'phone.required' => '手机必须填写',
        'phone.digits' => '手机号码格式不正确',
        'password.required' => '密码必须填写',
        'password.confirmed' => '两次密码输入不一致',
        ];
    }
}
